package com.iraeta.controller;

import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.iraeta.entity.main.WeiXinLiZhi;
import com.iraeta.service.hik.IWeiXinLiZhiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 微信离职Controller
 * 
 * @author 陈宾
 * @date 2023-10-06
 */
@RestController
@RequestMapping("/iraeta/weixinlizhi")
public class WeiXinLiZhiController extends BaseController
{
    @Autowired
    private IWeiXinLiZhiService weiXinLiZhiService;

    /**
     * 查询微信离职列表
     */
    @RequestMapping("/list")
    public String list(@RequestBody JSONObject jo)
    {
        WeiXinLiZhi weiXinLiZhi = new WeiXinLiZhi();
        weiXinLiZhi.setName(jo.getString("name"));
        this.pageSet(jo);
        List<WeiXinLiZhi> list = weiXinLiZhiService.selectWeiXinLiZhiList(weiXinLiZhi);
        PageInfo<WeiXinLiZhi> WeiXinLiZhiPageInfo = this.getPageInfo(list);
        return this.success(WeiXinLiZhiPageInfo);
    }

    /**
     * 获取微信离职详细信息
     */
    @GetMapping(value = "/{id}")
    public String getInfo(@PathVariable("id") Long id)
    {
        weiXinLiZhiService.selectWeiXinLiZhiById(id);
        return success();
    }

    /**
     * 新增微信离职
     */
    @PostMapping
    public String add(@RequestBody WeiXinLiZhi weiXinLiZhi)
    {
        weiXinLiZhiService.insertWeiXinLiZhi(weiXinLiZhi);
        return success();
    }

    /**
     * 修改微信离职
     */
    @PutMapping
    public String edit(@RequestBody WeiXinLiZhi weiXinLiZhi)
    {
        weiXinLiZhiService.updateWeiXinLiZhi(weiXinLiZhi);
        return success();
    }

    /**
     * 删除微信离职
     */
	@DeleteMapping("/{ids}")
    public String remove(@PathVariable Long[] ids)
    {
        weiXinLiZhiService.deleteWeiXinLiZhiByIds(ids);
        return success();
    }
}
